package com.bi.autotest.operations.payprocessoperation;

import com.auto.base.OperateAppium;
import com.bi.autotest.operations.operations_open.PayProcessOpenOperation;
import com.bi.autotest.pages.page_open.PayProcessOpenPage;
import com.bi.autotest.pages.payprocesspage.NewCScanBPage;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;

/**
 * Created by yidian on 2018/4/23.
 */
public class NewCScanBOperation extends OperateAppium {

    private PayProcessOpenPage payProcessOpenPage;
    private PayProcessOpenOperation payProcessOpenOpreation;
    private NewCScanBPage newCScanBPage;
    private MarketOperation marketOperation;

    public NewCScanBOperation(AndroidDriver androidDriver) {
        super(androidDriver);
        newCScanBPage = new NewCScanBPage(androidDriver);
        marketOperation = new MarketOperation(driver);
        payProcessOpenPage=new PayProcessOpenPage(androidDriver);
        payProcessOpenOpreation = new PayProcessOpenOperation(driver);
    }

    //长按二维码
    public void longPressQRCodeImg() {
        if (driver.getContext().equals("WEBVIEW_com.tencent.mm:tools")) {
            switchAppContext();
        }
        print("长按二维码");
        longPress(540, 772);
        sleep(2000);
        AndroidElement ae2 = newCScanBPage.getChooseQRCode();
        ae2.click();
        sleep(3000);
    }

    public boolean receiptsWX() {
        closePop_Up();
        boolean selfHelpReceiptsWX = selfHelpReceiptsWX("0.01");
        pressBackKey();
        sleep(2000);
        pressBackKey();
        sleep(2000);
        pressBackKey();
        sleep(2000);
        pressBackKey();
        sleep(2000);
        pressBackKey();
        sleep(2000);
        return selfHelpReceiptsWX;
    }

    public boolean vipMarketingLJJ() {
        boolean isgiveOutSucess = marketOperation.giveOutGold("10");
        switchAppContext();
        sleep(2000);
        pressCloseButton();
        sleep(2000);
        pressBackKey();
        sleep(2000);
        return isgiveOutSucess;
    }

    public boolean receiptsLJJ() {
        boolean isPopUpMessage = PopUpMessage("最高立减", "10.00元");
        print("码上惠弹窗显示最高立减10.00元是否成功：" + isPopUpMessage);
        closePop_Up();
        // print(driver.getPageSource());
        switchAppContext();
        payProcessOpenOpreation.click_InputMoney("5");
        switchH5Context();
        //检验支付前，确认订单数据
        boolean isPreBillCorrect = isPreBillCorrect("5", null, "5.00", "￥ 5.00", null, null);
        print("确认账单的数据是否正确情况：" + isPreBillCorrect);
        //点击会员卡付款
        switchAppContext();
        click_PayBtn();
        sleep(3000);
        switchH5Context();
        boolean isBillCorrect = isBillCorrect("¥0.00", "付款成功", "￥5.00", "￥5.00", null, null,null);
        print("支付完成账单的数据是否正确情况：" + isBillCorrect);
        pressBackKey();
        sleep(2000);
        return isPopUpMessage && isPreBillCorrect && isBillCorrect;
    }

    public boolean receiptsWX_LJJ() {
        boolean isPopUpMessage = PopUpMessage("最高立减", "5.00元");
        print("码上惠弹窗显示最高立减5.00元是否成功：" + isPopUpMessage);
        closePop_Up();
        // print(driver.getPageSource());
        switchAppContext();
        payProcessOpenOpreation.click_InputMoney("5.01");
        switchH5Context();
        //检验支付前，确认订单数据
        boolean isPreBillCorrect;
        boolean prePayDrder = newCScanBPage.isPrePayDrder("5.01");
        boolean prePayLJJ = newCScanBPage.isPrePayLJJ("5.00");
        boolean prePayMoney = newCScanBPage.isPrePayMoney("￥ 0.01");
        boolean prePayButton = newCScanBPage.isPrePayButton("微信付款");
        if (prePayDrder && prePayLJJ && prePayMoney && prePayButton) {
            isPreBillCorrect = true;
        } else {
            isPreBillCorrect = false;
        }
        print("输入5.01元,确认账单的数据是否正确情况：" + isPreBillCorrect);
        //点击付款按钮
        switchAppContext();
        click_PayBtn();
        sleep(8000);
        payProcessOpenOpreation.passWord();
        sleep(5000);
        boolean isPaySuccess = payProcessOpenPage.isExistWeiXinPaySuccessText();
        print("微信0.01元  是否支付成功的情况：" + isPaySuccess);
        //微信支付成功页面点击完成按钮
        payProcessOpenPage.getWeiXinPayCompleteButton().click();
        sleep(3000);
        switchH5Context();
        boolean isBillCorrect;
        boolean payMoney = newCScanBPage.isPayMoney("¥0.01");
        boolean payState = newCScanBPage.isPayState("付款成功");
        boolean payPrimecost = newCScanBPage.isPayPrimecost("￥5.01");
        boolean payLJJ = newCScanBPage.isPayPreferential_1("￥5.00");
        if (payMoney && payState && payPrimecost && payLJJ) {
            isBillCorrect = true;
        } else {
            isBillCorrect = false;
        }
        print("输入5.01元,微信+立减金账单的数据是否正确情况：" + isBillCorrect);
        switchAppContext();
        //点击关闭按钮
        pressCloseButton();
        sleep(2000);
        //点击设备返回按钮
        pressBackKey();
        sleep(2000);
        pressBackKey();
        sleep(2000);
        return isPopUpMessage && isPreBillCorrect && isBillCorrect;
    }

    public boolean vipMarketingDiscount() {
        boolean isgiveOutSucess = marketOperation.giveOutDiscount("5", "3");
        print("发放5折，次数3次，期限不限折扣：" + isgiveOutSucess);
        return isgiveOutSucess;
    }

    public boolean receiptsDiscount() {
        boolean isPopUpMessage = PopUpMessage("5.0折", "剩余3次");
        print("码上惠弹窗显示最高立减5.00元是否成功：" + isPopUpMessage);
        closePop_Up();
        payProcessOpenOpreation.click_InputMoney("0.1");
        switchH5Context();
        //检验支付前，确认订单数据
        boolean isPreBillCorrect;
        boolean prePayDrder = newCScanBPage.isPrePayDrder("0.1");
        boolean prePayDiscount = newCScanBPage.isPrePayDiscount("0.05");
        boolean prePayMoney = newCScanBPage.isPrePayMoney("￥ 0.05");
        boolean prePayButton = newCScanBPage.isPrePayButton("微信付款");
        if (prePayDrder && prePayDiscount && prePayMoney && prePayButton) {
            isPreBillCorrect = true;
        } else {
            isPreBillCorrect = false;
        }
        print("输入0.1元,5折确认账单的数据是否正确情况：" + isPreBillCorrect);
        //点击付款按钮
        switchAppContext();
        click_PayBtn();
        sleep(8000);
        payProcessOpenOpreation.passWord();
        sleep(5000);
        //微信支付完成页面，点击完成
        boolean isPaySuccess = payProcessOpenPage.isExistWeiXinPaySuccessText();
        print("微信0.1元,5折是否支付成功的情况：" + isPaySuccess);
        //微信支付成功页面点击完成按钮
        payProcessOpenPage.getWeiXinPayCompleteButton().click();
        sleep(3000);
        switchH5Context();
        boolean isBillCorrect;
        boolean payMoney = newCScanBPage.isPayMoney("¥0.05");
        boolean payState = newCScanBPage.isPayState("付款成功");
        boolean payPrimecost = newCScanBPage.isPayPrimecost("￥0.10");
        boolean payPreferential1 = newCScanBPage.isPayPreferential_1("￥0.05");
        boolean payMethod = newCScanBPage.isPayMethod("微信支付");
        if (payMoney && payState && payPrimecost && payPreferential1 && payMethod) {
            isBillCorrect = true;
        } else {
            isBillCorrect = false;
        }
        print("输入5.01元,微信+折扣账单的数据是否正确情况：" + isBillCorrect);
        switchAppContext();
        //点击关闭按钮
        pressCloseButton();
        sleep(2000);
        //点击设备返回按钮
        pressBackKey();
        sleep(2000);
        pressBackKey();
        sleep(2000);
        return isPopUpMessage && isPreBillCorrect && isBillCorrect;
    }

    public boolean payDiscountLJJ() {
        boolean isPopUpMessage = PopUpMessage("5.0折", "剩余2次", "折上最高再减 10.00元");
        print("码上惠弹窗显示情况：" + isPopUpMessage);
        closePop_Up();
        // print(driver.getPageSource());
        switchAppContext();
        print("切换完成app");
        click_1();
        click_confirm();
        sleep(3000);
        switchH5Context();
        //检验支付前，确认订单数据
        boolean isPreBillCorrect;
        boolean prePayDrder = newCScanBPage.isPrePayDrder("1");
        boolean prePayDiscount = newCScanBPage.isPrePayDiscount("0.50");
        boolean prePayLJJ = newCScanBPage.isPrePayLJJ("0.50");
        boolean prePayMoney = newCScanBPage.isPrePayMoney("￥ 0.50");
        if (prePayDrder && prePayDiscount && prePayMoney && prePayLJJ) {
            isPreBillCorrect = true;
        } else {
            isPreBillCorrect = false;
        }
        print("输入1元,5折,立减确认账单的数据是否正确情况：" + isPreBillCorrect);
        //点击付款按钮
        switchAppContext();
        click_PayBtn();
        sleep(3000);
        switchH5Context();
        boolean isBillCorrect;
        boolean payMoney = newCScanBPage.isPayMoney("¥0.00");
        boolean payState = newCScanBPage.isPayState("付款成功");
        boolean payPrimecost = newCScanBPage.isPayPrimecost("￥1.00");
        boolean payPreferential_1 = newCScanBPage.isPayPreferential_1("￥0.50");
        boolean payPreferential_2 = newCScanBPage.isPayPreferential_2("￥0.50");
        if (payMoney && payState && payPrimecost && payPreferential_1 && payPreferential_2) {
            isBillCorrect = true;
        } else {
            isBillCorrect = false;
        }
        print("输入1元,5折,立减账单的数据是否正确情况：" + isBillCorrect);
        pressBackKey();
        sleep(2000);
        return isPopUpMessage && isPreBillCorrect && isBillCorrect;
    }

    public boolean payDiscountLJJWeiXin() {
        boolean isPopUpMessage = PopUpMessage("5.0折", "剩余1次", "折上最高再减 9.50元");
        print("码上惠弹窗显示是否成功：" + isPopUpMessage);
        closePop_Up();
        // print(driver.getPageSource());
        switchAppContext();
        print("切换完成app");
        payProcessOpenOpreation.click_InputMoney("19.01");//19.01
        switchH5Context();
        //检验支付前，确认订单数据
        boolean isPreBillCorrect;
        boolean prePayDrder = newCScanBPage.isPrePayDrder("19.01");
        boolean prePayDiscount = newCScanBPage.isPrePayDiscount("9.50");
        boolean prePayLJJ = newCScanBPage.isPrePayLJJ("9.50");
        boolean prePayMoney = newCScanBPage.isPrePayMoney("￥ 0.01");
        boolean prePayButton = newCScanBPage.isPrePayButton("微信付款");
        if (prePayDrder && prePayDiscount && prePayLJJ && prePayMoney && prePayButton) {
            isPreBillCorrect = true;
        } else {
            isPreBillCorrect = false;
        }
        print("输入19.01元,5折,立减,微信确认账单的数据是否正确情况：" + isPreBillCorrect);
        //点击付款按钮
        switchAppContext();
        click_PayBtn();
        sleep(8000);
        payProcessOpenOpreation.passWord();
        sleep(5000);
        boolean isPaySuccess = payProcessOpenPage.isExistWeiXinPaySuccessText();
        print("输入19.01元,5折,立减,微信是否支付成功的情况：" + isPaySuccess);
        //微信支付成功页面点击完成按钮
        payProcessOpenPage.getWeiXinPayCompleteButton().click();
        sleep(3000);
        switchH5Context();
        boolean isBillCorrect;
        boolean payMoney = newCScanBPage.isPayMoney("¥0.01");
        boolean payState = newCScanBPage.isPayState("付款成功");
        boolean payPrimecost = newCScanBPage.isPayPrimecost("￥19.01");
        boolean payPreferential_1 = newCScanBPage.isPayPreferential_1("￥9.50");
        boolean payPreferential_2 = newCScanBPage.isPayPreferential_2("￥9.50");
        boolean payMethod = newCScanBPage.isPayMethod("微信支付");
        if (payMoney && payState && payPrimecost && payPreferential_1 && payPreferential_2 && payMethod) {
            isBillCorrect = true;
        } else {
            isBillCorrect = false;
        }
        print("输入19.01元,5折,立减,微信账单的数据是否正确情况：" + isBillCorrect);
        switchAppContext();
        //点击关闭按钮
        pressCloseButton();
        sleep(2000);
        return isPopUpMessage && isPreBillCorrect && isBillCorrect;
    }

    public boolean MarketingDiscount() {
        boolean isgiveOutSucess = marketOperation.giveOutDiscount("1", "2");
        print("发放折扣，期限不限折扣：" + isgiveOutSucess);
        return isgiveOutSucess;
    }

    public boolean receiptsVipPrice() {
        switchH5_C_W("设置金额");
        newCScanBPage.getSetMoneyButton().click();
        newCScanBPage.getGoodsInputs().click();
        newCScanBPage.getGoodsAddButton1().click();
        newCScanBPage.getSureAddButton().click();
        sleep(5000);
        boolean isQRcodeMoney =newCScanBPage.isQRcodeMoney("¥3.00");
        print("选取商品的金额情况：" + isQRcodeMoney);
        boolean isGoodsCount = newCScanBPage.isGoodsCount("共1件商品 >>");
        print("选取商品的数量情况：" +isGoodsCount);
        boolean isQRcodePageParam = isQRcodeMoney && isGoodsCount;
        longPressQRCodeImg();

        boolean isPopUpMessage = PopUpMessage("1.0折", "剩余2次");
        print("码上惠弹窗显示是否成功：" + isPopUpMessage);
        closePop_Up();

        boolean isPayAmount = newCScanBPage.isPayAmount("3.00");
        print("输入框金额情况：" + isPayAmount);
        boolean isNoInput = newCScanBPage.isNoInput();
        print("不可以键盘输入情况：" + isNoInput);
        boolean isDescribe = newCScanBPage.isDescribe("共1件商品，订单金额:￥3.00");
        print("描述商品数量和订单金额情况：" + isDescribe);
        boolean isGoodsName = newCScanBPage.isGoodsName("娃哈哈");
        print("商品名称情况：" + isGoodsName);
        boolean isSelfPayPageParam = isPayAmount && isNoInput && isDescribe && isGoodsName;
        newCScanBPage.getSurePayButton().click();
        sleep(2000);
        boolean isPreBillCorrect = isPreBillCorrect("3.00", "- ￥2.90", "￥ 0.10", "微信付款");
        print("确认账单的数据是否正确情况：" + isPreBillCorrect);

        //点击XX付款按钮
        switchAppContext();
        click_PayBtn();
        sleep(8000);
        payProcessOpenOpreation.passWord();
        sleep(5000);
        payProcessOpenPage.getWeiXinPayCompleteButton().click();
        sleep(3000);

        switchH5Context();
        boolean isBillCorrect = isBillCorrect("¥0.10", "付款成功", "￥3.00", "￥2.90", null, "微信支付",null);
        print("支付完成账单的数据是否正确情况：" + isBillCorrect);
        //点击查看权益，进入会员卡页面
        AndroidElement checkBenefitButton = newCScanBPage.getCheckBenefitButton();
        checkBenefitButton.click();
        return isQRcodePageParam && isPopUpMessage && isSelfPayPageParam && isPreBillCorrect && isBillCorrect;
    }

    public boolean payStoreValueCard(String money) {
        boolean isPopUpMessag = PopUpMessage("1.0折", "剩余2次");
        print("码上惠弹窗显示是否成功：" + isPopUpMessag);
        closePop_Up();
        switchAppContext();
        payProcessOpenOpreation.click_InputMoney(money);
        switchH5Context();
        boolean isPreBillCorrect = isPreBillCorrect("500", "450.00", null, "￥ 50.00", null, "会员卡付款");
        print("确认账单的数据是否正确情况：" + isPreBillCorrect);
        //点击XX付款按钮
        switchAppContext();
        click_PayBtn();
        sleep(3000);
        switchH5Context();
        boolean isBillCorrect = isBillCorrect("¥50.00", "付款成功", "￥500.00", "￥450.00", null, "花鸟虫鱼测试01卡支付","￥50.00");
        //额外验证会员卡余额情况
        boolean vipCardMoney = newCScanBPage.isVipCardMoney("(会员卡余额￥50.00)");
        if (!isBillCorrect && vipCardMoney ) {
            isBillCorrect = false;
        }
        print("支付完成账单的情况：" + isBillCorrect);
        pressBackKey();
        sleep(2000);
        return isPopUpMessag && isPreBillCorrect && isBillCorrect;
    }

    public boolean payStoreValueCard_WX(String money) {
        boolean isPopUpMessag = PopUpMessage("1.0折", "剩余1次");
        print("码上惠弹窗显示是否成功：" + isPopUpMessag);
        closePop_Up();
        payProcessOpenOpreation.click_InputMoney(money);
        switchH5Context();
        boolean isPreBillCorrect = isPreBillCorrect("500.1", "450.09", null, "￥ 0.01", null, "微信付款");
        //额外验证会员卡余额抵扣
        boolean prePayVipCard = newCScanBPage.isPrePayVipCard("- ￥50.00");
        if (!isPreBillCorrect && prePayVipCard ) {
            isPreBillCorrect = false;
        }
        print("确认账单的数据是否正确情况：" + isPreBillCorrect);

        //点击XX付款按钮
        switchAppContext();
        click_PayBtn();
        sleep(8000);
        payProcessOpenOpreation.passWord();
        sleep(5000);
        payProcessOpenPage.getWeiXinPayCompleteButton().click();
        sleep(3000);

        switchH5Context();
        boolean isBillCorrect = isBillCorrect("¥50.01", "付款成功", "￥500.10", "￥450.09", null, "花鸟虫鱼测试01卡支付","￥50.00");
        //额外验证会员卡余额情况
        boolean vipCardMoney = newCScanBPage.isVipCardMoney("(会员卡余额￥0.00)");
        if (!isBillCorrect && vipCardMoney ) {
            isBillCorrect = false;
        }
        print("支付完成账单的情况：" + isBillCorrect);
        return isPopUpMessag && isPreBillCorrect && isBillCorrect;
    }

    //判段确认支付按钮的颜色是否改变
    public boolean btnColor() {
        //关闭码上惠弹窗
        closePop_Up();
        boolean isExistBtnClass = newCScanBPage.isExistBtnClass();
        sleep(2000);
        switchAppContext();
        sleep(2000);
        pressCloseButton();
        sleep(2000);
        return isExistBtnClass;
    }

    /**
     * 自助付款（微信）
     *
     * @param money 付款金额
     */
    public boolean selfHelpReceiptsWX(String money) {
        if (driver.getContext().equals("WEBVIEW_com.tencent.mm:tools")) {
            switchAppContext();
        }
        payProcessOpenOpreation.click_InputMoney(money);
        sleep(8000);
        //输入支付密码
        payProcessOpenOpreation.passWord();
        sleep(5000);
        boolean isPaySuccess = payProcessOpenPage.isExistWeiXinPaySuccessText();
        print("输入0.01元  是否支付成功的情况：" + isPaySuccess);
        return isPaySuccess;
    }

    /**
     * 码上惠弹窗无优惠显示是否正确,
     */
    public boolean PopUpMessage() {
        return PopUpMessage(null, null, null);
    }

    /**
     * 码上惠弹窗优惠1显示是否正确,
     */
    public boolean PopUpMessage(String type, String limit) {
        return PopUpMessage(type, limit, null);
    }

    /**
     * 码上惠弹窗显示是否正确,优惠1和优惠2
     *
     * @param type  优惠类型
     * @param limit 额度
     * @param text  第二条优惠，文本内容
     */
    public boolean PopUpMessage(String type, String limit, String text) {
        if (driver.getContext().equals("NATIVE_APP")) {
            switchH5_C_W("码上惠");
        }
        //无优惠
        boolean popUpMessageNull = newCScanBPage.isPopUpMessageNull();
        if (popUpMessageNull) {
            print(driver.findElementByXPath("//div[contains(text(), '商家还没有给你优惠哟')]").getText());
            return popUpMessageNull;
        }
        //优惠1
        boolean popUpMessageType = newCScanBPage.isPopUpMessageType(type);
        boolean popUpMessageLimit = newCScanBPage.isPopUpMessageLimit(limit);
        boolean popUpMessage2 = true;
        //优惠2
        if (text != null) {
            popUpMessage2 = newCScanBPage.isPopUpMessage2(text);
        }
        return popUpMessageType && popUpMessageLimit && popUpMessage2;
    }


    //点击关闭码上惠弹窗
    public void closePop_Up() {
        if (driver.getContext().equals("NATIVE_APP")) {
            switchH5_C_W("码上惠");
        }
        print("关闭弹窗");
        //如果含有码上惠的图层则去点击去付款按钮
        if (newCScanBPage.getMSHCloseButton() != null) {
            newCScanBPage.getMSHCloseButton().click();
        }
        sleep(2000);
    }

    /**
     * H5 自助付款 按键click_等等
     */
    //点击键盘确认支付按钮
    public void click_confirm() {
        press(971, 1779);
        sleep(3000);
    }

    //点击键盘回退键
    public void click_backspace() {
        press(971, 1350);
        sleep(1000);
    }

    //点击1
    public void click_1() {
        press(138, 1422);
        sleep(1000);
    }

    //在确认支付账单详情弹窗点击 (会员卡付款/微信支付）
    public void click_PayBtn() {
        press(971, 1850);
        sleep(1000);
    }

    /**
     * 支付确认账单内容是否正确(折扣,消费立减,会员卡支付)
     *
     * @param payDrder    订单金额数据，是否正确
     * @param payDiscount 折扣，是否正确
     * @param payLJJ      消费立减数据，是否正确
     * @param payMoney    付款金额数据
     * @param paySeller   商户名称 XXX卡支付，是否正确
     * @param payButton   付款按钮
     */
    public boolean isPreBillCorrect(String payDrder, String payDiscount, String payLJJ, String payMoney, String paySeller, String payButton) {
        boolean isPayDrder = true;
        boolean isPayDiscount = true;
        boolean isPayLJJ = true;
        boolean isPayMoney = true;
        boolean isPaySeller = true;
        boolean isPayButton = true;

        if (payDrder != null) {
            isPayDrder = newCScanBPage.isPrePayDrder(payDrder);
        }
        if (payDiscount != null) {
            isPayDiscount = newCScanBPage.isPrePayDiscount(payDiscount);
        }
        if (payLJJ != null) {
            isPayLJJ = newCScanBPage.isPrePayLJJ(payLJJ);
        }
        if (payMoney != null) {
            isPayMoney = newCScanBPage.isPrePayMoney(payMoney);
        }
        if (paySeller != null) {
            isPaySeller = newCScanBPage.isPrePaySeller(paySeller);
        }
        if (payButton != null) {
            isPayButton = newCScanBPage.isPrePayButton(payButton);
        }
        boolean isPreBillCorrect = isPayDrder && isPayDiscount && isPayLJJ && isPayMoney && isPaySeller && isPayButton;
        return isPreBillCorrect;
    }

    /**
     * 支付确认账单内容是否正确,会员价，微信付款
     *
     * @param payDrder    订单金额数据，是否正确
     * @param payVipPrice 会员价优惠（新增）
     * @param payMoney    付款金额数据
     * @param payButton   付款按钮
     */
    public boolean isPreBillCorrect(String payDrder, String payVipPrice, String payMoney, String payButton) {
        boolean isPreBillCorrect = isPreBillCorrect(payDrder, null, null, payMoney, null, payButton);
        boolean isPayVipPrice = true;
        if (payVipPrice != null) {
            isPayVipPrice = newCScanBPage.isPrePayVipPrice(payVipPrice);
        }
        boolean isPreBillCorrectEx = isPreBillCorrect && isPayVipPrice;
        return isPreBillCorrectEx;
    }


    /**
     * 支付完成账单内容是否正确
     *
     * @param payMoney          付款金额数据
     * @param payState          付款状态
     * @param payPrimecost      订单原价
     * @param payPreferential_1 优惠1
     * @param payPreferential_2 优惠2
     * @param payMethod         支付方式
     * @param payActualMoney    实际支付金额
     */
    public boolean isBillCorrect(String payMoney, String payState, String payPrimecost, String payPreferential_1, String payPreferential_2, String payMethod,String payActualMoney) {
        boolean isPayMoney = true;
        boolean isPayState = true;
        boolean isPayPrimecost = true;
        boolean isPayPreferential_1 = true;
        boolean isPayPreferential_2 = true;
        boolean isPayMethod = true;
        boolean isPayActualMoney = true;

        if (payMoney != null) {
            isPayMoney = newCScanBPage.isPayMoney(payMoney);
        }
        if (payState != null) {
            isPayState = newCScanBPage.isPayState(payState);
        }
        if (payPrimecost != null) {
            isPayPrimecost = newCScanBPage.isPayPrimecost(payPrimecost);
        }
        if (payPreferential_1 != null) {
            isPayPreferential_1 = newCScanBPage.isPayPreferential_1(payPreferential_1);
        }
        if (payPreferential_2 != null) {
            isPayPreferential_2 = newCScanBPage.isPayPreferential_2(payPreferential_2);
        }
        if (payMethod != null) {
            isPayMethod = newCScanBPage.isPayMethod(payMethod);
        }
        if (payActualMoney != null) {
            isPayActualMoney = newCScanBPage.isPayWeiXinMoney(payActualMoney);
        }

        boolean isBillCorrect = isPayMoney && isPayState && isPayPrimecost && isPayPreferential_1 && isPayPreferential_2 && isPayMethod && isPayActualMoney;
        return isBillCorrect;
    }
}
